package com.an.spring.beanlife;

import java.util.*;

public class Boos {

    private Set ofav = new HashSet();

    @Override
    public String toString() {
        return "Boos{" +
                "ofav=" + ofav +
                ", mails=" + mails +
                ", id='" + id + '\'' +
                ", boosName='" + boosName + '\'' +
                ", favorites=" + favorites +
                ", jobs=" + jobs +
                ", car=" + car +
                '}';
    }

    public void setOfav(Set ofav) {
        this.ofav = ofav;
    }

    public Set getOfav() {

        return ofav;
    }

    //Properties类型可以看作Map类型的特例，Map元素的键和值可以是任何类型的对象，properties的
    //键和值都只能是字符串
    private Properties mails = new Properties();

    public void setMails(Properties mails) {
        this.mails = mails;
    }

    public Properties getMails() {

        return mails;
    }

    private String id;

    private String boosName;

    private List<String> favorites;

    private Map<String,String> jobs = new HashMap<String, String>();

    public void setJobs(Map<String, String> jobs) {
        this.jobs = jobs;
    }

    public Map<String, String> getJobs() {

        return jobs;
    }

    public List<String> getFavorites() {
        return favorites;
    }

    public void setFavorites(List<String> favorites) {

        this.favorites = favorites;
    }

    //在使用级联属性时，必须进行为属性声明一个初始化的对象
    /**
    *若不提供初始化的对象,如 private Car car;//= new Car();--------->则：会抛出异常
     * org.springframework.beans.NullValueInNestedPathException: Invalid property 'car'
     * of bean class [com.an.spring.beanlife.Boos]: Value of nested property 'car' is null
     *
     */
    private Car car = new Car();

    public void setId(String id) {
        this.id = id;
    }

    public void setBoosName(String boosName) {
        this.boosName = boosName;
    }

    public void setCar(Car car) {
        this.car = car;
    }

    public String getId() {
        return id;
    }

    public String getBoosName() {
        return boosName;
    }

    public Car getCar() {
        return car;
    }
}
